<%@page import="com.hxzy.jsp.dao.UserDAOImpl"%>
<%@page import="com.hxzy.jsp.dao.PostDAOImpl"%>
<%@page import="com.hxzy.jsp.dao.PostDAO"%>
<%@page import="com.hxzy.jsp.utils.Page"%>
<%@page import="com.hxzy.jsp.entity.Post"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="./assets/css/bbs.css">
<style type="text/css">
</style>
<title>我的帖子</title>
</head>
<body>
<header class="header">
    </header>
    <div class="container">
        <div class="row">
            <div class="col-md-9">
                <div class="panel panel-default">
                    <div class="panel-heading clearfix">
                        <ul class="nav nav-pills pull-left">
                            <li class="active"><a href="">全部</a></li>
                            <li><a href="">回复最多</a></li>
                            <li><a href="">点赞最多</a></li>
                        </ul>
                        <a href="./my" class="btn btn-success pull-right">${user.nickname }的帖子</a>
                    </div>
                    <div class="panel-body">
                        <!-- 帖子列表：开始 -->
                       <c:forEach items="${postList}" var="post" varStatus="status">
                        
                             <div class="media">
                            <div class="media-left">
                                <a href="./topic?id=${post.id }"><img
                                    src="https://avatars.githubusercontent.com/u/6915570?v=3"
                                    class="avatar" alt=""></a>
                            </div>
                            <div class="media-body">
                                <div class="title">
                                    <a href="./topic?id=${post.id }">${post.title }</a>
                                </div>
                                <div class="clearfix">
                                    <p class="gray pull-left">
                                        <span class="label label-primary">置顶</span> <span>•</span> <span><a
                                            href="user.jsp?id=${post.userid }">${post.usernickname }</a></span>
                                        <span class="hidden-sm hidden-xs">•</span> <span
                                            class="hidden-sm hidden-xs">${post.like }个点赞</span> <span
                                            class="hidden-sm hidden-xs">•</span> <span
                                            class="hidden-sm hidden-xs">${post.hit }次浏览</span>
                                    </p>
                                    <p class="gray pull-right">
                                        <span class="hidden-sm hidden-xs">from: ${post.ip }</span>
                                    </p>
                                </div>
                            </div>
                        </div>
                        </c:forEach> 
                       <%--  <%
                        PostDAO postDAO = new PostDAOImpl();
                        List<Post> postList = postDAO.findMy(user.getNickname());
                        out.print(user.getUserid());
                        for (Post post : postList) {
                        %>
                         <div class="media">
                            <div class="media-left">
                                <a href="./topic?id=<%=post.getId()%>"><img
                                    src="https://avatars.githubusercontent.com/u/6915570?v=3"
                                    class="avatar" alt=""></a>
                            </div>
                            <div class="media-body">
                                <div class="title">
                                    <a href="./topic?id=<%=post.getId()%>"><%=post.getTitle()%></a>
                                </div>
                                <div class="clearfix">
                                    <p class="gray pull-left">
                                        <span class="label label-primary">置顶</span> <span>•</span> <span><a
                                            href="user.jsp?id=<%=post.getUserId()%>"><%=post.getUserNickname()%></a></span>
                                        <span class="hidden-sm hidden-xs">•</span> <span
                                            class="hidden-sm hidden-xs"><%=post.getLike()%>个点赞</span> <span
                                            class="hidden-sm hidden-xs">•</span> <span
                                            class="hidden-sm hidden-xs"><%=post.getHits()%>次浏览</span>
                                    </p>
                                    <p class="gray pull-right">
                                        <span class="hidden-sm hidden-xs">from: <%=post.getIp()%></span>
                                    </p>
                                </div>
                            </div>
                        </div> 
                        <%
                        }
                        %>  --%>
                        <!-- 帖子列表：结束 -->

                        <!-- 分页：开始 -->
                       
                        <!-- 分页：结束 -->
                    </div>

                </div>
            </div>
            <div class="col-md-3">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <h5>码农社区</h5>
                        <p>在这里，您可以分享问题，分享经验，点赞，这是个属于程序员的社区，欢迎您的加入！</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <footer class="footer">
        <%@ include file="/WEB-INF/fragment/footer.jsp"%>
    </footer>
</body>
</html>